import { NgModule, SkipSelf, Optional } from '@angular/core';
import { CommonModule} from '@angular/common';
import { RouterModule } from '@angular/router';
import { FormsModule } from '@angular/forms';
import { TreeModule, DataTableModule, SharedModule } from 'primeng/primeng';
import { CoreModule } from '../core/core.module';
import { PublicModule } from '../public/public.module';
import { DragulaModule } from 'ng2-dragula';
import { BsDatepickerModule }  from 'ngx-bootstrap/datepicker';
import {MatButtonModule,MatInputModule} from '@angular/material';

import { InstitutionService } from '../user/services/institution.service';
import { DatabaseService } from '../system/database/database.service';
import { SidebarModule } from '../sidebar/sidebar.module';
import { SystemComponent } from '../system/system.component';
import { SystemSysconfigComponent } from './sysconfig/sysconfig.component';
import { TaskComponent } from './task/task.component';
import { JournalComponent } from './journal/journal.component';
import { TerminalComponent } from './terminal/terminal.component';
import { IpRuleComponent } from './ip-rule/ip-rule.component';
import { ScopeAuthorizationComponent } from './scope-authorization/scope-authorization.component';
import { ApplicationComponent } from './application/application.component';
import { TerminalTableComponent } from './terminal/terminal-table/terminal-table.component';
import { TerminalEditComponent } from './terminal/terminal-edit/terminal-edit.component';
import { TerminalDetailsComponent } from './terminal/terminal-details/terminal-details.component';
import { TerminalNewlyAddedComponent } from './terminal/terminal-newly-added/terminal-newly-added.component';
import { TerminalDeleteComponent } from './terminal/terminal-delete/terminal-delete.component';
import { ScopesDeleteComponent } from './scope-authorization/scopes-delete/scopes-delete.component';
import { ScopesDetailsComponent } from './scope-authorization/scopes-details/scopes-details.component';
import { ScopesEditComponent } from './scope-authorization/scopes-edit/scopes-edit.component';
import { ScopesNewlyAddedComponent } from './scope-authorization/scopes-newly-added/scopes-newly-added.component';
import { ScopesTableComponent } from './scope-authorization/scopes-table/scopes-table.component';
import { SysconfigDeleteComponent } from './sysconfig/sysconfig-delete/sysconfig-delete.component';
import { SysconfigDetailsComponent } from './sysconfig/sysconfig-details/sysconfig-details.component';
import { SysconfigEditComponent } from './sysconfig/sysconfig-edit/sysconfig-edit.component';
import { SysconfigNewlyAddedComponent } from './sysconfig/sysconfig-newly-added/sysconfig-newly-added.component';
import { SysconfigTableComponent } from './sysconfig/sysconfig-table/sysconfig-table.component';
import { ApplicationTableComponent } from './application/application-table/application-table.component';
import { ApplicationDetailsComponent } from './application/application-details/application-details.component';
import { ApplicationEditComponent } from './application/application-edit/application-edit.component';
import { ApplicationNewlyAddedComponent } from './application/application-newly-added/application-newly-added.component';
import { ApplicationDeleteComponent } from './application/application-delete/application-delete.component';
import { IpRuleTableComponent } from './ip-rule/ip-rule-table/ip-rule-table.component';
import { IpRuleDeleteComponent } from './ip-rule/ip-rule-delete/ip-rule-delete.component';
import { IpRuleDetailsComponent } from './ip-rule/ip-rule-details/ip-rule-details.component';
import { IpRuleEditComponent } from './ip-rule/ip-rule-edit/ip-rule-edit.component';
import { IpRuleNewlyAddedComponent } from './ip-rule/ip-rule-newly-added/ip-rule-newly-added.component';
import { JournalTableComponent } from './journal/journal-table/journal-table.component';
import { JournalDetailsComponent } from './journal/journal-details/journal-details.component';
import { JournalDeletethreeComponent } from './journal/journal-deletethree/journal-deletethree.component';
import { JournalDeleteallComponent } from './journal/journal-deleteall/journal-deleteall.component';
import { TaskDeleteComponent } from './task/task-delete/task-delete.component';
import { TaskDetailsComponent } from './task/task-details/task-details.component';
import { TaskAddComponent } from './task/task-add/task-add.component';
import { TaskUpdateComponent } from './task/task-update/task-update.component';
import { TaskTableComponent } from './task/task-table/task-table.component';
import { TaskSearchComponent } from './task/task-search/task-search.component';
import { TreeComponent } from './application/tree/tree.component';
import { IpRuleTreeComponent } from './ip-rule/tree/tree.component';
import { DatabaseComponent } from './database/database.component';
import { DatabaseAddComponent } from './database/database-add/database-add.component';
import { DatabaseDetailsComponent } from './database/database-details/database-details.component';
import { DatabaseDeteleComponent } from './database/database-detele/database-detele.component';
import { DatabaseUpdateComponent } from './database/database-update/database-update.component';
import { DatabaseTableComponent } from './database/database-table/database-table.component';
import { DatabaseSearchComponent } from './database/database-search/database-search.component';

import { from } from 'rxjs';
import { CentralComponent } from './central/central.component';
import { CentralTableComponent } from './central/central-table/central-table.component';
import { CentralAddComponent } from './central/central-add/central-add.component';
import { CentralDeleteComponent } from './central/central-delete/central-delete.component';

import { ProductTypeComponent } from './product-type/product-type.component';
import { ProductTypeTableComponent } from './product-type/product-type-table/product-type-table.component';
import { ProductTypeDetailsComponent } from './product-type/product-type-details/product-type-details.component';
import { ProductTypeTreeComponent } from './product-type/product-type-tree/product-type-tree.component';
import { ProductTypeAddComponent } from './product-type/product-type-add/product-type-add.component';
import { ProductTypeEditComponent } from './product-type/product-type-edit/product-type-edit.component';
import { ProductTypeDeleteComponent } from './product-type/product-type-delete/product-type-delete.component';

import { KeywordTableManagementComponent } from './keyword-table-management/keyword-table-management.component';
import { KeywordTableTableComponent } from './keyword-table-management/keyword-table-table/keyword-table-table.component';
import { KeywordTableAddComponent } from './keyword-table-management/keyword-table-add/keyword-table-add.component';
import { KeywordTableDetailsComponent } from './keyword-table-management/keyword-table-details/keyword-table-details.component';
import { KeywordTableEditComponent } from './keyword-table-management/keyword-table-edit/keyword-table-edit.component';
import { KeywordTableDeleteComponent } from './keyword-table-management/keyword-table-delete/keyword-table-delete.component';
import { TreeTableModule } from '../public/treetable/treetable';

import { PushedComponent } from './pushed/pushed.component';
import { PushedTableComponent } from './pushed/pushed-table/pushed-table.component';
import { PushedEditComponent } from './pushed/pushed-edit/pushed-edit.component';
import { PushedAddComponent } from './pushed/pushed-add/pushed-add.component';
import { PushedDetailsComponent } from './pushed/pushed-details/pushed-details.component';
import { PushedDeleteComponent } from './pushed/pushed-delete/pushed-delete.component';

import { TemplatePathComponent } from './template-path/template-path.component';

import {InnerindexStyleComponent} from './innerindex-style/innerindex-style.component';
import {InnerindexStyleFormComponent} from './innerindex-style/innerindex-style-form/innerindex-style-form.component';
import { TemplatePathTableComponent } from './template-path/template-path-table/template-path-table.component';
import { TemplatePathUpdateComponent } from './template-path/template-path-update/template-path-update.component';
import { TemplatePathDetailsComponent } from './template-path/template-path-details/template-path-details.component';
import { TemplatePathAddComponent } from './template-path/template-path-add/template-path-add.component';
import { TemplatePathDeleteComponent } from './template-path/template-path-delete/template-path-delete.component';

import { ThemetableTagComponent } from './themetable-tag/themetable-tag.component';
import { ThemetableTagTableComponent } from './themetable-tag/themetable-tag-table/themetable-tag-table.component';
import { ThemeTagComponent } from './theme-tag/theme-tag.component';
import { ThemeTagTableComponent } from './theme-tag/theme-tag-table/theme-tag-table.component';
import { ThemeTagDeleteComponent } from './theme-tag/theme-tag-delete/theme-tag-delete.component';
import { ThemeTagUpdateComponent } from './theme-tag/theme-tag-update/theme-tag-update.component';
import { ThemeTagAddComponent } from './theme-tag/theme-tag-add/theme-tag-add.component';
import {ThemetableTagAddComponent} from './themetable-tag/themetable-tag-add/themetable-tag-add.component';
import {ThemetableTagDetailsComponent} from './themetable-tag/themetable-tag-details/themetable-tag-details.component';
import {ThemetableTagEditComponent} from './themetable-tag/themetable-tag-edit/themetable-tag-edit.component';
import {ThemetableTagDeleteComponent} from './themetable-tag/themetable-tag-delete/themetable-tag-delete.component';
import {KeywordTableExportComponent} from './keyword-table-management/keyword-table-export/keyword-table-export.component';
import {DatabaseConfigComponent} from './database/database-config/database-config.component';

import { FileUploadModule } from 'ng2-file-upload';
import {KeywordTableImportComponent} from './keyword-table-management/keyword-table-import/keyword-table-import.component';
import { ProjectComponent } from './project/project.component';
import { ProjectAddComponent } from './project/project-add/project-add.component';
import { ProjectEditComponent } from './project/project-edit/project-edit.component';
import { ProjectDeleteComponent } from './project/project-delete/project-delete.component';
import { ProjectTableComponent } from './project/project-table/project-table.component';
import { ProjectSettingComponent } from './project/project-setting/project-setting.component';
import { ProjectDetailsComponent } from './project/project-details/project-details.component';
import { ProjectSettingAddComponent } from './project/project-setting/project-setting-add/project-setting-add.component';
import { ProductTaskTemplateComponent } from './product-task-template/product-task-template.component';
import { ProductTaskTemplateAttributeComponent } from './product-task-template-attribute/product-task-template-attribute.component';
import { TemplateTableComponent } from './product-task-template/template-table/template-table.component';
import { TemplateAddComponent } from './product-task-template/template-add/template-add.component';
import { TemplateEditComponent } from './product-task-template/template-edit/template-edit.component';
import { TemplateDeleteComponent } from './product-task-template/template-delete/template-delete.component';
import { TemplateDetailsComponent } from './product-task-template/template-details/template-details.component';
import { TemplateAttributeTableComponent } from './product-task-template-attribute/template-attribute-table/template-attribute-table.component';
import { TemplateAttributeAddComponent } from './product-task-template-attribute/template-attribute-add/template-attribute-add.component';
import { TemplateAttributeEditComponent } from './product-task-template-attribute/template-attribute-edit/template-attribute-edit.component';
import { TemplateAttributeDeleteComponent } from './product-task-template-attribute/template-attribute-delete/template-attribute-delete.component';
import { TemplateAttributeDetailsComponent } from './product-task-template-attribute/template-attribute-details/template-attribute-details.component';
import { TemplateListComponent } from './product-task-template-attribute/template-list/template-list.component';
import { KeywordTableDownloadComponent } from './keyword-table-management/keyword-table-download/keyword-table-download.component';

@NgModule({
  imports: [
    CommonModule,
    RouterModule,
    CoreModule,
    SidebarModule,
    FormsModule,
    TreeModule,
    DragulaModule,
    PublicModule,
    TreeTableModule,
    MatButtonModule,
    FileUploadModule,
    BsDatepickerModule.forRoot()
  ],
  declarations: [
    SystemComponent,
    SystemSysconfigComponent,
    TaskComponent,
    JournalComponent,
    TerminalComponent,
    IpRuleComponent,
    ScopeAuthorizationComponent,
    ApplicationComponent,
    TerminalTableComponent,
    TerminalEditComponent,
    TerminalDetailsComponent,
    TerminalNewlyAddedComponent,
    TerminalDeleteComponent,
    ScopesDeleteComponent,
    ScopesDetailsComponent,
    ScopesEditComponent,
    ScopesNewlyAddedComponent,
    ScopesTableComponent,
    SysconfigDeleteComponent,
    SysconfigDetailsComponent,
    SysconfigEditComponent,
    SysconfigNewlyAddedComponent,
    SysconfigTableComponent,
    ApplicationTableComponent,
    ApplicationDetailsComponent,
    ApplicationEditComponent,
    ApplicationNewlyAddedComponent,
    ApplicationDeleteComponent,
    IpRuleComponent,
    IpRuleTableComponent,
    IpRuleDeleteComponent,
    IpRuleDetailsComponent,
    IpRuleEditComponent,
    IpRuleNewlyAddedComponent,
    JournalTableComponent,
    JournalDetailsComponent,
    JournalDeletethreeComponent,
    JournalDeleteallComponent,
    TaskDeleteComponent,
    TaskDetailsComponent,
    TaskAddComponent,
    TaskUpdateComponent,
    TaskTableComponent,
    TaskSearchComponent,
    TreeComponent,
    IpRuleTreeComponent,
    DatabaseComponent,
    DatabaseAddComponent,
    DatabaseDetailsComponent,
    DatabaseDeteleComponent,
    DatabaseUpdateComponent,
    DatabaseTableComponent,
    DatabaseSearchComponent,
      DatabaseConfigComponent,
    CentralComponent,
    CentralTableComponent,
    CentralAddComponent,
    CentralDeleteComponent,
    ProductTypeTableComponent,
    ProductTypeComponent,
    ProductTypeDetailsComponent,
    ProductTypeTreeComponent,
    ProductTypeAddComponent,
    ProductTypeEditComponent,
    ProductTypeDeleteComponent,
    KeywordTableManagementComponent,
    KeywordTableAddComponent,
    KeywordTableDetailsComponent,
    KeywordTableEditComponent,
    KeywordTableDeleteComponent,
    KeywordTableExportComponent,
    KeywordTableTableComponent,
    PushedComponent,
    PushedTableComponent,
    PushedEditComponent,
    PushedDetailsComponent,
    PushedDeleteComponent,
    PushedAddComponent,
    TemplatePathComponent,
    InnerindexStyleComponent,
    InnerindexStyleFormComponent,
    TemplatePathTableComponent,
    TemplatePathAddComponent,
    TemplatePathUpdateComponent,
    TemplatePathDeleteComponent,
    TemplatePathDetailsComponent,
    TemplatePathDetailsComponent,
    TemplatePathAddComponent,
    TemplatePathDeleteComponent,
    ThemetableTagComponent,
    ThemetableTagTableComponent,
    ThemetableTagAddComponent,
    ThemetableTagDetailsComponent,
    ThemetableTagEditComponent,
    ThemetableTagDeleteComponent,
    ThemeTagComponent,
    ThemeTagTableComponent,
    ThemeTagDeleteComponent,
    ThemeTagUpdateComponent,
    ThemeTagAddComponent,
    KeywordTableImportComponent,
    ProjectComponent,
    ProjectAddComponent,
    ProjectEditComponent,
    ProjectDeleteComponent,
    ProjectTableComponent,
    ProjectSettingComponent,
    ProjectDetailsComponent,
    ProjectSettingAddComponent,
    ProductTaskTemplateComponent,
		ProductTaskTemplateAttributeComponent,
		TemplateTableComponent,
		TemplateAddComponent,
		TemplateEditComponent,
		TemplateDeleteComponent,
		TemplateDetailsComponent,
		TemplateAttributeTableComponent,
		TemplateAttributeAddComponent,
		TemplateAttributeEditComponent,
		TemplateAttributeDeleteComponent,
		TemplateAttributeDetailsComponent,
		TemplateListComponent,
		KeywordTableDownloadComponent,
  ],
  exports: [
    SystemComponent,
    SystemSysconfigComponent,
    TaskComponent,
    JournalComponent,
    TerminalComponent,
    IpRuleComponent,
    ScopeAuthorizationComponent,
    ApplicationComponent,
    ProductTypeComponent,
    ProductTypeTreeComponent

  ],
  providers: [InstitutionService,DatabaseService]
})
export class SystemModule {
  constructor( @Optional() @SkipSelf() parent: SystemModule) {
    if (parent) {
      throw new Error('system模块已经加载，不要再次加载');
    }
  }
}
